import Router from '@koa/router';

import AuthController from './controllers/auth';
import UserController from './controllers/user';
const baseUrl = '/api'
const unprotectedRouter = new Router();

unprotectedRouter.post(baseUrl + '/auth/login', AuthController.login);
unprotectedRouter.post(baseUrl + '/auth/register', AuthController.register);
unprotectedRouter.get(baseUrl + '/hello', UserController.hello);

const protectedRouter = new Router();
protectedRouter.get(baseUrl + '/users', UserController.listUsers);
protectedRouter.get(baseUrl + '/users/:id', UserController.showUserDetails);
protectedRouter.put(baseUrl + '/users/:id', UserController.updateUser);
protectedRouter.delete(baseUrl + '/users/:id', UserController.deleteUser);

export { protectedRouter, unprotectedRouter};